package Test;

import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.ProgressBar;
import org.eclipse.swt.widgets.Shell;

public class Main1
{
 public static void main(String[] args)
 {
  Display display = Display.getDefault();
  Shell shell = new Shell();
  shell.setBounds(50, 50, 682, 600);
  shell.open();

  final Label label = new Label(shell, SWT.NONE);
  label.setText("Label");

  final Label label_1 = new Label(shell, SWT.NONE);
  label_1.setText("欢迎使用书店进销存管理系统");
  label_1.setBounds(28, 146, 636, 69);

  final ProgressBar progressBar = new ProgressBar(shell, SWT.NONE);
  progressBar.setBounds(105, 395, 449, 17);
  shell.layout();
  shell.getDisplay().asyncExec(new Runnable(){
  
   public void run()
   {
    System.out.println("dddd");
    for(int i = 1; i < 11; i++)
    {
     progressBar.setSelection(i * 10);
     try
     {
      Thread.sleep(1000);
     }
     catch (Throwable t)
     {
      t.printStackTrace();
     }
    }
   }
  });
//  shell.addShellListener(new ShellAdapter()
//  {
//
//   public void shellActivated(ShellEvent e)
//   {
//    System.out.println("dddd");
//    for(int i = 1; i < 11; i++)
//    {
//     progressBar.setSelection(i * 10);
//     try
//     {
//      Thread.sleep(1000);
//     }
//     catch (Throwable t)
//     {
//      t.printStackTrace();
//     }
//    }
//
//   }
//
//  });

while(!shell.isDisposed())
  {
   if(!display.readAndDispatch())
    display.sleep();
  }
  display.dispose();
 }
}